﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sexybeauty.Core.Inf.Entities.Table;
using Sexybeauty.Framework.Common;

namespace Sexybeauty.Core.Inf.LogicEntity
{
    public class AccountStreamEntity : IAccessible<AccountStream,AccountStreamEntity>
    {
        #region Fileds
        public int Id { get; set; }
        /// <summary>
        /// 付款: 0 分利:1
        /// </summary>
        public LockStreamType StreamType { get; set; }
        /// <summary>
        /// 支付流水id
        /// </summary>
        public string PayStreamId { get; set; }
        /// <summary>
        /// 支付串
        /// </summary>
        public string PayString { get; set; }
        /// <summary>
        /// 发起支付时间
        /// </summary>
        public DateTime PayLockDate { get; set; }
        /// <summary>
        /// 支付返回时间
        /// </summary>
        public DateTime PayBackDate { get; set; }
        /// <summary>
        /// 支付返回串
        /// </summary>
        public string PayBackString { get; set; }
        /// <summary>
        /// 付款人 可以是匿名支付，不记录付款者
        /// </summary>
        public string Payer { get; set; }
        /// <summary>
        /// 收款人
        /// </summary>
        public string Payee { get; set; }
        /// <summary>
        /// 付款金额
        /// </summary>
        public decimal Money { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Comment { get; set; }
        /// <summary>
        /// 系统信息
        /// </summary>
        public string Message { get; set; }
        #endregion

        protected override void Covariant(AccountStream dbModel)
        {
            this.Id = dbModel.Id;
            this.StreamType = (LockStreamType)dbModel.StreamType;
            this.PayStreamId = dbModel.PayStreamId;
            this.PayString = dbModel.PayString;
            this.PayLockDate = dbModel.PayLockDate;
            this.PayBackDate = dbModel.PayBackDate;
            this.PayBackString = dbModel.PayBackString;
            this.Payer = dbModel.Payer;
            this.Payee = dbModel.Payee;
            this.Money = dbModel.Money;
            this.Comment = dbModel.Comment;
            this.Message = dbModel.Message;
        }
        protected override AccountStream Inverter(AccountStreamEntity model)
        {
            return new AccountStream()
            {
                Comment = model.Comment,
                Id = model.Id,
                Message = model.Message,
                Money = model.Money,
                PayBackDate = model.PayBackDate,
                PayBackString = model.PayBackString,
                Payee = model.Payee,
                Payer = model.Payer,
                PayLockDate = model.PayLockDate,
                PayStreamId = model.PayStreamId,
                PayString = model.PayString,
                StreamType = (int)model.StreamType
            };
        }
    }
}
